import React from "react";
import {useRoutes} from "react-router-dom";
import Index from "@/pages/Index";
import Login from "@/pages/Login";
import NotFound from "@/pages/NotFound";

// 1- 自定义hook函数
// export default function useRenderRouter  (){
//     return useRoutes([
//         {
//             path:"/",
//             element:<Index/>
//         },{
//             path:"/login",
//             element:<Login/>
//         },{
//             path:"*",
//             element:<NotFound/>
//         }
//     ])
// }

// 2- 将hooks放置到匿名函数中导出
export default function (){
    return useRoutes([
        {
            path:"/",
            element:<Index/>
        },{
            path:"/login",
            element:<Login/>
        },{
            path:"*",
            element:<NotFound/>
        }
    ])
}
